﻿using System;
using DotNetNeural.Data.Utils;

namespace DotNetNeural.Data.Learning
{
    public class TrainingSetItem
    {
        public float[] Input { get; private set; }

        public float[] Output { get; private set; }

        public TrainingSetItem(float[] input, float[] output)
        {
            if (input == null || output == null)
                throw new NullReferenceException("Illegal null-reference args");

            Input = input;
            Output = output;
        }

        public bool Compare(TrainingSetItem obj)
        {
            if (obj == null)
                return false;

            if (Input == null && obj.Input != null ||
                 Output == null && obj.Output != null)
                return false;

            return Input.Compare(obj.Input, ArrayExtensions.DefaultEqualityDelta) &&
                Output.Compare(obj.Output, ArrayExtensions.DefaultEqualityDelta);
        }
    }
}
